var _INDEX = '1';
var _TYPE = 'MerchantWords:Search Keyword Detail';

function log(msg,level = config.LOG._LOG_LEVEL_DEBUG) {
    logger.out(`{${_TYPE} (index:${_INDEX})} ` + msg,level)
}

function parser() {
    let result = {
        rows :{
        },
        code:Const._RETCODE_SUCCESS
    };
    if(!htmlString || htmlString === ''){
        result.code = _RETCODE_HANDLER_FAILED;
        return result;
    }
    let rows = JSON.parse(htmlString);
    log(`detail response:${rows.success}`);
    if(!rows.success){
        result.code = Const._RETCODE_HANDLER_FAILED;
    }else{
        result.rows = rows;
    }
    return result;
}

try {
    result = parser();
    parserInfo.index = _INDEX;
    parserInfo.type = _TYPE;
} catch (e) {
    log(`Parsing Exception:${e.message}`,config.LOG._LOG_LEVEL_ERROR);
    result.code = Const._RETCODE_HANDLER_FAILED;
}

